package jpaperwork.web;

import org.junit.Test;
import org.junit.Assert;

import java.util.Map;

/**
 * User: fleipold
 * Date: Nov 1, 2009
 * Time: 10:14:59 PM
 */
public class TemplateTest {

    @Test
    public void ShouldMatchSimpleUrl(){
        Template template = new Template("test/me");
        Assert.assertNotNull(template.matches("test/me"));
        Assert.assertNull(template.matches("test/m"));
    }

    @Test
    public void ShouldMatchMoreComplicatedUrl(){
        Template template = new Template("test/{name}/me");
        Map<String,String> map = template.matches("test/78/me");
        Assert.assertNotNull(map);
        Assert.assertEquals("78", map.get("name"));

        map = template.matches("test/flx/me");
        Assert.assertEquals("flx", map.get("name"));


    }
}
